<?php

namespace App\Http\WechatAuth\Services;

use App\Http\WechatAuth\Models\User;
use App\Http\WechatAuth\Models\UserToken;
use App\Http\WechatAuth\Services\AuthContract;
use App\Http\WechatAuth\Models\SmallRoutine;
use App\Http\WechatAuth\Models\PlatformStore;

class AuthService implements AuthContract
{

    public $user;

    private $small_routine;

    private $store;

    public function __construct()
    {
        $this->user = new User();
    }

    public function checkToken($id, $token)
    {

        $login = UserToken::where(['id' => $id, 'token' => $token])->first();

        if (!isset($login)) {
            return false;
        }
        $this->user = $this->user->find($login->uid);
        
        return isset($this->user);
    }
}
